<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>短信/邮箱配置</title>
 <link rel="stylesheet" href="<?=adminassets?>assets/pear/component/pear/css/pear.css" />
</head>

<body class="pear-container">


    <div class="layui-card layui-form" lay-filter="component-form-element" style="margin-top: 10px;">
        <div class="layui-tab layui-tab-card">
            <ul class="layui-tab-title">
                <li class="layui-this">邮箱配置</li>
                <li>短信接口设置</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <form onsubmit="return saveSetting(this)" method="post" role="form">

                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">发信模式</label>
                                <div class="layui-input-block">
                                    <select name="mail_cloud" default="<?php echo $conf['mail_cloud'] ?>">
                                        <option value="2" <?= $conf['mail_cloud'] == 2 ? "selected" : "" ?>>阿里云邮件推送</option>
                                        <option value="1" <?= $conf['mail_cloud'] == 1 ? "selected" : "" ?>>搜狐Sendcloud</option>
                                        <option value="0" <?= $conf['mail_cloud'] == 0 ? "selected" : "" ?>>SMTP发信</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <?php 
                        if($conf['mail_cloud'] == 0){ ?>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">SMTP服务器</label>
                                <div class="layui-input-block">
                                    <input type="text" name="mail_smtp" value="<?php echo $conf['mail_smtp']; ?>" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <hr>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">SMTP端口</label>
                                <div class="layui-input-block">
                                    <input type="text" name="mail_port" value="<?php echo $conf['mail_port']; ?>" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">邮箱账号</label>
                                <div class="layui-input-block">
                                    <input type="text" name="mail_name" value="<?php echo $conf['mail_name']; ?>" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <hr>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">邮箱授权码</label>
                                <div class="layui-input-block">
                                    <input type="text" name="mail_pwd" value="<?php echo $conf['mail_pwd']; ?>" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <?php
                        }?>
                        <div id="frame_set2" style="<?php if($conf['mail_cloud'] != 0){}else echo 'display:none;'; ?>">
                            <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">邮箱账号</label>
                                <div class="layui-input-block">
                                    <input type="text" name="mail_name2" value="<?php echo $conf['mail_name2']; ?>" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <hr>
                            <div class="layui-col-md6">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">API_USER</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="mail_apiuser" value="<?php echo $conf['mail_apiuser']; ?>" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <hr>
                            <div class="layui-col-md6">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">API_KEY</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="mail_apikey" value="<?php echo $conf['mail_apikey']; ?>" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        </div>
                            <div class="layui-col-md6">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">收信邮箱</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="mail_recv" value="<?php echo $conf['mail_recv']; ?>" class="layui-input">
                                    </div>
                                </div>
                            </div>
                        <hr>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button type="submit" class="pear-btn pear-btn-primary">更新数据</button>
                                <?php if ($conf['mail_name']) { ?><button id="testSendMail" type="button" class="pear-btn pear-btn-danger">发封测试邮件</button><?php } ?>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="layui-tab-item">
                    <form onsubmit="return saveSetting(this)" method="post" role="form">

                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">接口选择</label>
                                <div class="layui-input-block">
                                    <select name="sms_api" default="<?php echo $conf['sms_api'] ?>">
                                         <option value="1" <?= $conf['sms_api'] == 1 ? "selected" : "" ?>>腾讯云短信接口</option>
                                        <option value="2" <?= $conf['sms_api'] == 2 ? "selected" : "" ?>>阿里云短信接口</option>
                                        <option value="3" <?= $conf['sms_api'] == 3 ? "selected" : "" ?>>短信宝接口</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                        <?php 
                        if($conf['sms_api'] == '2'){
                            echo '
                            <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">阿里云Access Key ID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="ali_sms_akid" value="'.$conf['ali_sms_akid'].'" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <hr>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">阿里云Access Key Secret</label>
                                <div class="layui-input-block">
                                    <input type="text" name="ali_sms_aks" value="'.$conf['ali_sms_aks'].'" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">短信签名内容</label>
                                <div class="layui-input-block">
                                    <input type="text" name="ali_sms_qm" value="'.$conf['ali_sms_qm'].'" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <hr>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">商户注册模板ID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="ali_sms_regid" value="'.$conf['ali_sms_regid'].'" class="layui-input">
                                </div>
                                 <b>申请模板：您正在申请手机注册，验证码为：${code}，5分钟内有效！</b>
                            </div>
                        </div>

                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">找回密码模板ID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="ali_sms_find" value="'.$conf['ali_sms_find'].'" class="layui-input">
                                </div>
                                <b>申请模板：您正在操作找回密码，您的验证码是${code}，该验证码5分钟内有效，请勿泄露于他人，如非本人操作，请及时更改密码！</b>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">修改密码模板ID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="ali_sms_modify" value="'.$conf['ali_sms_modify'].'" class="layui-input">
                                </div>
                                <b>申请模板：您正在操作修改密码，您的验证码是${code}，该验证码5分钟内有效，请勿泄露于他人，如非本人操作，请及时更改密码！</b>
                            </div>
                        </div>
                             <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">通用验证码类模板ID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="ali_sms_univer" value="'.$conf['ali_sms_univer'].'" class="layui-input">
                                </div>
                                <b>申请模板：您的验证码是${code}，该验证码5分钟内有效，如非本人操作请忽略！</b>
                            </div>
                        </div>
                        <hr>
                         
                            ';
                        }else if($conf['sms_api'] == '1'){
                        echo '<div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">AppId</label>
                                <div class="layui-input-block">
                                    <input type="text" name="sms_appid" value="'.$conf['sms_appid'].'" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <hr>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">AppKey</label>
                                <div class="layui-input-block">
                                    <input type="text" name="sms_appkey" value="'.$conf['sms_appkey'].'" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">短信签名内容</label>
                                <div class="layui-input-block">
                                    <input type="text" name="sms_sign" value="'.$conf['sms_sign'].'" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <hr>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">商户注册模板ID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="sms_tpl_reg" value="'.$conf['sms_tpl_reg'].'" class="layui-input">
                                </div>
                                <b>申请模板：您正在申请手机注册，验证码为：{1}，{2}分钟内有效！ 需传输两个参数</b>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">商户手机验证模板ID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="sms_tpl_phoneauth" value="'.$conf['sms_tpl_phoneauth'].'" class="layui-input">
                                </div>
                                <b>申请模板：您的验证码为：{1}，您正在进行手机验证，验证码有效期为{2}，若非本人操作，请勿泄露！ 需传输两个参数</b>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">商户注册成功通知模板ID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="sms_tpl_phonesuccid" value="'.$conf['sms_tpl_phonesuccid'].'" class="layui-input">
                                </div>
                                <b>申请模板：恭喜您注册成功！您的平台账号为{1}，您的平台密码为{2}，请勿泄露账号和密码避免被盗！ 需传输两个参数</b>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">找回密码模板ID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="sms_tpl_find" value="'.$conf['sms_tpl_find'].'" class="layui-input">
                                </div>
                                <b>申请模板：您正在申请找回密码，验证码为：{1}，{2}分钟内有效，如非本人操作请忽略，并及时修改密码！ 需传输两个参数</b>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">修改密码模板ID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="sms_tpl_modify" value="'.$conf['sms_tpl_modify'].'" class="layui-input">
                                </div>
                                <b>申请模板：您正在申请修改密码，验证码为：{1}，{2}分钟内有效，如非本人操作请忽略，并及时修改密码！ 需传输两个参数</b>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">通用验证码类模板ID</label>
                                <div class="layui-input-block">
                                    <input type="text" name="sms_tpl_univer" value="'.$conf['sms_tpl_univer'].'" class="layui-input">
                                </div>
                                <b>申请模板：您的验证码为：{1}，{2}分钟内有效，如非本人操作请忽略！ 需传输两个参数</b>
                            </div>
                        </div>
                        <hr>';
                        }else if($conf['sms_api'] == '3'){
                            echo '
                                <div class="layui-col-md6">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">短信宝账号</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="smsbao_user" value="'.$conf['smsbao_user'].'" class="layui-input">
                                    </div>
                                </div>
                            </div>
                            <hr>
                            <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">短信宝key</label>
                                <div class="layui-input-block">
                                    <input type="text" name="smsbao_key" value="'.$conf['smsbao_key'].'" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">短信签名内容</label>
                                <div class="layui-input-block">
                                    <input type="text" name="smsbao_qm" value="'.$conf['smsbao_qm'].'" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <hr>
                            ';
                        }
                        ?>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <label class="layui-form-label">测试手机号</label>
                                <div class="layui-input-block">
                                    <input type="text" name="sms_csphone" value="<?=$conf['sms_csphone']?>" class="layui-input">
                                </div>
                            </div>
                        </div>
                        <hr>
                        <div class="layui-col-md6">
                            <div class="layui-form-item">
                                <button style="margin-left: 25px;" type="submit" class="pear-btn pear-btn-primary">更新数据</button>
                                <?php if ($conf['sms_csphone']) { ?><button id="testSendSMS" type="button" class="pear-btn pear-btn-danger">发封测试验证码</button><?php } ?>
                            </div>
                             
                        </div>
                       
                        <hr>
                        <div class="layui-input-item">
                            <a href="https://console.cloud.tencent.com/sms/smslist" class="layui-btn layui-btn-sm layui-btn-normal">腾讯云短信接口</a>
                            <a href="https://dysms.console.aliyun.com/dysms.htm" class="layui-btn layui-btn-sm layui-btn-normal">阿里云短信接口</a>
                            <a href="https://www.smsbao.com/" class="layui-btn layui-btn-sm layui-btn-normal">短信宝接口</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>


    </div>
</body>
<script src="<?=adminassets?>assets/pear/component/layui/layui.js"></script>
<script src="<?=adminassets?>assets/pear/component/pear/pear.js"></script>
<script src="<?=adminassets?>assets/js/core_js/mail.js"></script>
</html>